//
//  BaseViewController.swift
//  SwiftDemo
//
//  Created by zhudeshuai on 2018/9/14.
//  Copyright © 2018年 zhudeshuai. All rights reserved.
//

import Foundation
import UIKit
//基类UIViewController，实现一些基础功能
class BaseViewController: UIViewController {
    //顶部导航高度
    let TOP_VIEW_HEIGHT = 45
    //顶部导航区
    let topBar = TopBar()
    //内容显示区
    let contentView = UIView()
    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        addTopView()
        addContentView()
    }
    
    //定义显示主容器
    func addContentView() {
        contentView.backgroundColor = UIColor.brown
        self.view.addSubview(contentView)
        contentView.snp.makeConstraints{(make) in
            make.top.equalTo(topBar.snp.bottom)
            make.width.equalToSuperview()
            make.bottom.equalToSuperview()
        }
    }
    //定制顶部导航
    func addTopView() {
        topBar.backgroundColor = UIColor.red
        self.view.addSubview(topBar)
        topBar.snp.makeConstraints{(make) in
            make.top.equalTo(Constants.DEVICE_STATUS_HEIGHT)
            make.width.equalToSuperview()
            make.height.equalTo(TOP_VIEW_HEIGHT)
        }
        topBar.setBackBlock {
            self.dismiss(animated: true, completion: nil)
        }

    }
   
}
